<?
include_once('../conn.php');
include_once('../include/func.php');
include("../user_check.php") ;
if($_POST){
	array_pop($_POST);
	if($_POST[password]==null or $_POST[password2]==null){
		exit('<script>alert("'.MEMBER_RESET_PASSWORD_NULL.'"); location=\'reset_password.php?reset\';</script>');
		}elseif(strlen($_POST[password])<6){
			exit('<script>alert("'.MEMBER_PASSWORD_CONFIRM_WARNING.'"); location=\'reset_password.php?reset\';</script>');
			}elseif($_POST[password]<>$_POST[password2]){
				exit('<script>alert("'.MEMBER_PASSWORD_CONFIRM_WARNING2.'"); location=\'reset_password.php?reset\';</script>');
				}
				$v=md5(htmlspecialchars($_POST[password], ENT_QUOTES));
				$db->UPDATE("UPDATE `".tablepre."user` SET `password`='".$v."' WHERE (`uid`='".$checkmember[0][2]."') limit 1");

	exit('<script>parent.location.href = "../";</script>');
	}
if(!isset($_GET[reset])){
echo '<iframe src="./include/reset_password.php?reset" frameborder="0" scrolling="no" height="100px" width="100%" noresize="noresize"></iframe> ';
}
if(isset($_GET[reset])){
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>password</title>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

<style>
.jc_lable1{
	width:120px; }
body,td,th {
	font-size: 12px;
	color: #333;}
	img{
		border:0;}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script type="text/javascript" src="../js/jquery.PrintArea.js"></script>
<script type="text/javascript">
    jQuery(document).ready(function($) {
	  $("div#print_button").click(function(){
    $("div#myPrintArea").printArea();
});
    })
		////////
</script>

</head>

<body><form id="form1" name="form1" method="post" action="">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><? echo MEMBER_RESET_PASSWORD;?></td>
    <td>
      <input type="text" name="password"  id="password" />
    </td>
  </tr>
    <tr>
    <td><? echo MEMBER_PASSWORD_CONFIRM;?></td>
    <td>
      <input type="text" name="password2"  id="password2" />
    </td>
  </tr>
    <tr>
    <td></td>
    <td><input type="submit" name="button" id="button" onclick="checkForm()" value="<? echo MEMBER_RESET;?>"/></td>
  </tr>
</table>
</form>

</body>
</html>
<? }?>